import type { AxiosRequestConfig, AxiosResponse } from 'axios'

// 真正的数据类型
export interface IRealData {
  code: number
  msg: string
  data: any
}

interface IInterceptors {
  requestSuccessFn?: (config: ILyRequestConfig) => ILyRequestConfig
  requestFailureFn?: (err: any) => any
  responseSuccessFn?: (res: AxiosResponse) => AxiosResponse<IRealData, any>
  responseFailureFn?: (err: any) => any
}

// 这个接口是axios配置项的超集,增加了拦截器的传入、请求万是否展示提示信息、是否展示加载动画
export interface ILyRequestConfig extends AxiosRequestConfig {
  interceptors?: IInterceptors
  isShowMsg?: boolean
  isShowLoading?: boolean
}
